package com.fwtai.api;

import com.fwtai.bean.PageFormData;
import com.fwtai.datasource.DaoHandle;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;

/**
 * 门店管理访问数据库
 * @作者 田应平
 * @版本 v1.0
 * @创建时间 2023-04-04 17:45:50
 * @QQ号码 444141300
 * @Email service@yinlz.com
 * @官网 <url>http://www.fwtai.com</url>
*/
@Repository
public class ApiStoreDao{

  private final DaoHandle dao;

  public ApiStoreDao(final DaoHandle dao){
    this.dao = dao;
  }

  public int add(final PageFormData formData){
    return dao.execute("api_store.add",formData);
  }

  public int edit(final PageFormData formData){
    return dao.execute("api_store.edit",formData);
  }

  public HashMap<String,String> queryExistById(final long kid){
    return dao.queryForHashMapString("api_store.queryExistById",kid);
  }

  public List<HashMap<String,String>> queryFiles(final long[] lists){
    return dao.queryForListString("api_store.queryFiles",lists);
  }

  public HashMap<String,Object> queryById(final long kid){
    return dao.queryForHashMap("api_store.queryById",kid);
  }

  public Long queryMyStoreId(final String kid){
    return dao.queryForLong("api_store.queryMyStoreId",kid);
  }

  public List<HashMap<String,Object>> getStoreGoods(final long kid){
    return dao.queryForListHashMap("api_store.getStoreGoods",kid);
  }

  public List<HashMap<String,Object>> getAreaGoods(final String kid){
    return dao.queryForListHashMap("api_store.getAreaGoods",kid);
  }

  public List<HashMap<String,Object>> getInviteAreaGoods(final Long kid){
    return dao.queryForListHashMap("api_store.getInviteAreaGoods",kid);
  }

  public int delById(final long kid){
    return dao.execute("api_store.delById",kid);
  }

  public int delByKeys(final long[] list){
    return dao.execute("api_store.delByKeys",list);
  }

  public List<HashMap<String,Object>> getListData(final PageFormData formData){
    return dao.queryForListHashMap("api_store.listData",formData);
  }

  public List<HashMap<String,Object>> getNearestStore(final PageFormData formData){
    return dao.queryForListHashMap("api_store.getNearestStore",formData);
  }

  public Integer getListTotal(final PageFormData formData){
    return dao.queryForInteger("api_store.listTotal",formData);
  }

  public List<HashMap<String,Object>> getAreaAgency(final Long areaId){
    return dao.queryForListHashMap("api_store.getAreaAgency",areaId);
  }

  public int editStoreThumbnail(final PageFormData formData){
    return dao.execute("api_store.editStoreThumbnail",formData);
  }

  public int editProtocol(final PageFormData formData){
    return dao.execute("api_store.editProtocol",formData);
  }
}